﻿//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------

using GameFramework;
using GameFramework.ObjectPool;
using UnityEngine;

namespace Adventure
{
    public class MonoPoolObject : ObjectBase
    {
        public static MonoPoolObject Create(object target)
        {
            MonoPoolObject cellItemObject = ReferencePool.Acquire<MonoPoolObject>();
            cellItemObject.Initialize(target);
            return cellItemObject;
        }

        protected override void Release(bool isShutdown)
        {
            MonoPoolItem cellItem = (MonoPoolItem)Target;
            if (cellItem == null)
                return;

            Object.Destroy(cellItem.gameObject);
        }
    }
}
